package com.cskaoyan.service.vx;

import com.cskaoyan.bean.po.wxPo.BrandDetailPo;
import com.cskaoyan.bean.po.wxPo.BrandPo;
import com.cskaoyan.bean.po.wxPo.MarketBrand;
import com.cskaoyan.bean.vo.TVO;
import com.cskaoyan.bean.vo.vxVo.BrandDetailVo;
import com.cskaoyan.mapper.wxMapper.MarketBrandMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author: DYQ
 * @time: Created on 2022/6/7 20:05
 */

@Service
public class MarketBrandServiceImpl implements MarketBrandService {

    @Autowired
    MarketBrandMapper marketBrandMapper;

    @Override
    public TVO queryBrandList(Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<BrandPo> brandPos = marketBrandMapper.selectBrandList();
        PageInfo pageInfo = new PageInfo(brandPos);
        return TVO.data(pageInfo.getTotal(), pageInfo.getPages(),limit, page, brandPos);
    }

    @Override
    public BrandDetailVo queryBrandDetail(Integer id) {
        BrandDetailPo brandDetailPo = marketBrandMapper.selectByPrimaryKeyAndDeleted(id);
        return BrandDetailVo.data(brandDetailPo);
    }
}
